<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
         #box{
             width: 200px;
             height: 200px !important;
             background: red;
         }
         #abox{
            background-color: red;  
         }
         .a-box{
             width: 100px;
             height: 100px;
             background-color: blue!important;
         }
        /* 10+10+10000 ==12000 */
        .box .a-box{
        background-color: blue!important;
        }
        .box{
            width: 100px;
           
        }
    </style>
</head>
<body>
    <div id="box">das <p>大撒大撒</p></div>
    <div class="a-box" id="abox" style="background-color:green"></div>
    <script>
        console.log(a);
        var a = 0; 
        function sum(){
            if(false){
                var a = 2;
            };
            console.log(a);
        }
        sum();
    
        //函数参数验证
        function ct(a,b){
            if(a == undefined || b == undefined || typeof a != 'number' || typeof b != 'number'){
                throw new Error('ct params ');
                return false
            }
            return a + b;
        }
        
        //console.log(ct("a","b"))
        //arguments [] 伪数组  具有length属性 不具备数组的方法
        function cts(){ 
            console.log(arguments);
            var arr  = new Array();
            for(var i = 0; i < arguments.length ; i++){
                arr.push(arguments[i])
            }
            console.log(arr)
        }
        cts(1,2)
        console.log(["1"]);

        //callback使用
        function sums(){
            var c  =2;
            return function (a,b,callback){
                callback(c)
            }
        }
        var _fn = sums();
        _fn(1,2,function(c){
            console.log(c)
        })
        //节点

        var box = document.getElementById('box');
        console.log(box);
        box.onclick = function(){
           box.innerHTML = "好";
           var str = box.innerHTML;
           console.log(str);
           box.style.backgroundColor = "green";
           box.style.fontSize = "30px";
        }
        //['','',''] 三个颜色    左右到又；
        //[ ] 三个颜色   left  【】 right；

        
        //权重
        //!important 10000
        //style  1000
        //id 100
        //class 10
        //tag 1

        function ssu(num,methods){
            console.log(num);
            console.log(methods());
        }
        ssu(1,function(){console.log(22)});
        
    </script>
</body>
</html>